﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using KaytechSoftware.Cms.App.Areas.Content.Models;
using KaytechSoftware.Cms.Services.Interfaces;
using KaytechSoftware.Cms.Services.Interfaces.Entity;

namespace KaytechSoftware.Cms.App.Areas.Content.Controllers
{
    public class PhotoGalleryController : ContentController
    {
        private readonly IPhotoAlbumService _photoAlbumService;

        public PhotoGalleryController(IPhotoAlbumService photoAlbumService)
        {
            _photoAlbumService = photoAlbumService;
        }

        public override PartialViewResult Content(long id)
        {
            var news = _photoAlbumService.GetAllForPage(id);
            var model = new PhotoGalleryModel();
            model.Items = news.Select(a => new PhotoAlbumModel { Id = a.Id, Title = a.Title, Description = a.Description, MainPhotoId = a.MainPhotoId, MainPhotoVersion = a.MainPhotoVersion, Order = a.Order }).ToList();

            return PartialView(model);
        }
    }
}
